import rxAjax from '@/assets/js/ajax.js';

//列表权限配置 api接口
export const FormBoPermissionApi = {};

FormBoPermissionApi.baseUrl= '/api-form/form/core/formBoPermission';
FormBoPermissionApi.exportUrl= FormBoPermissionApi.baseUrl + '/listExport';

//查询列表
FormBoPermissionApi.query=function (parameter) {
  var url= FormBoPermissionApi.baseUrl + '/query';
  return rxAjax.postJson(url,parameter).then (res => {
    return res.result
  })
}

/**
* 获取单记录
* @param pkId
* @returns {*}
*/
FormBoPermissionApi.get =function(pkId) {
  var url= FormBoPermissionApi.baseUrl + '/get?pkId=' + pkId;
  return rxAjax.get(url);
}

//保存数据
FormBoPermissionApi.save =function(parameter) {
  var url= FormBoPermissionApi.baseUrl + '/save';
  return rxAjax.postJson(url,parameter);
}

//删除数据
FormBoPermissionApi.del =function(parameter) {
  var url= FormBoPermissionApi.baseUrl + '/del';
  return rxAjax.postUrl(url,parameter);
}

//删除数据
FormBoPermissionApi.delPermissionByIds=function (parameter) {
  var url = FormBoPermissionApi.baseUrl + '/delPermissionByIds';
  return rxAjax.postUrl(url,parameter);
}

/**
 * 获取列表记录
 * @param pkId
 * @returns {*}
 */
FormBoPermissionApi.getList =function(boListId) {
  var url= FormBoPermissionApi.baseUrl + '/getList?boListId=' + boListId;
  return rxAjax.get(url);
}

FormBoPermissionApi.getListByKey=function(boListKey,appId){
  var url= FormBoPermissionApi.baseUrl + '/getListByKey?boListKey=' + boListKey;
    if (appId){
        url+='&appId='+appId;
    }
  return rxAjax.get(url);
}

export  default FormBoPermissionApi;

